﻿FROM mcr.microsoft.com/dotnet/runtime:5.0 AS base
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["Lawn.AppServer/Lawn.AppServer.csproj", "Lawn.AppServer/"]
RUN dotnet restore "Lawn.AppServer/Lawn.AppServer.csproj"
COPY . .
WORKDIR "/src/Lawn.AppServer"
RUN dotnet build "Lawn.AppServer.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Lawn.AppServer.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Lawn.AppServer.dll"]
